#ifndef __PROFILER_DOT_H_4DAG2MTX__
#define __PROFILER_DOT_H_4DAG2MTX__
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
#include <TimeDiff.h>
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
class Profiler {
   U64 count;
   string what;
   timespec tstart;
   timespec tstop;
public:
   void Start( void ) {
      clock_gettime( CLOCK_MONOTONIC, &tstart );
   }
   void Start( const string & _what ) {
      what = _what;
      clock_gettime( CLOCK_MONOTONIC, &tstart );
   }
   void Stop( void ) {
      clock_gettime( CLOCK_MONOTONIC, &tstop );
      count++;
      double dt = DiffTimespec( &tstart, &tstop );
      #ifdef __MAC_OSX__
      if( what == "" ) printf( "dt%llu = %.2f",      count, dt               );
      else             printf( "dt%llu = %.2f : %s", count, dt, what.c_str() );
      #else
      if( what == "" ) printf( "dt%lu = %.2f",      count, dt               );
      else             printf( "dt%lu = %.2f : %s", count, dt, what.c_str() );
      #endif
      cout << endl;
   }
   Profiler( void ) {
      what = "";
      count = 0ULL;
   }
};

#endif
